package com.redepronik.negosys.invfac.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * The persistent class for the estadokardex database table.
 * 
 */
@Entity
@Table(schema = "invfac", name = "estadokardex")
@NamedQuery(name = "Estadokardex.findAll", query = "SELECT e FROM Estadokardex e")
public class Estadokardex implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(allocationSize = 1, name = "ESTADOKARDEX_ESTADOKARDEXID_GENERATOR", sequenceName = "INVFAC.ESTADOKARDEX_ESTADOKARDEXID_SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ESTADOKARDEX_ESTADOKARDEXID_GENERATOR")
	@Column(unique = true, nullable = false)
	private Integer estadokardexid;

	@Column(nullable = false, length = 25)
	private String nombre;

	// bi-directional many-to-one association to Kardex
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "estadokardex")
	private List<Kardex> kardexs;

	public Estadokardex() {
	}

	public Kardex addKardex(Kardex kardex) {
		getKardexs().add(kardex);
		kardex.setEstadokardex(this);

		return kardex;
	}

	public Integer getEstadokardexid() {
		return this.estadokardexid;
	}

	public List<Kardex> getKardexs() {
		return this.kardexs;
	}

	public String getNombre() {
		return this.nombre;
	}

	public Kardex removeKardex(Kardex kardex) {
		getKardexs().remove(kardex);
		kardex.setEstadokardex(null);

		return kardex;
	}

	public void setEstadokardexid(Integer estadokardexid) {
		this.estadokardexid = estadokardexid;
	}

	public void setKardexs(List<Kardex> kardexs) {
		this.kardexs = kardexs;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

}